package com.test.seatastorage.controller;

import com.test.seatastorage.service.impl.StorageServiceImpl;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/storage")
public class StorageController {
    @Resource
    private StorageServiceImpl storageService;

    /**
     * 扣减库存
     */
    @PostMapping("/decrease")
    public String decrease(@RequestParam("productId") Long productId, @RequestParam("count") Integer count) {
        storageService.decrease(productId, count);
        return "扣减库存成功！";
    }
}
